<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>globalComponent</title>
</head>
<body>
<!-- 全局组件 -->
<div id="app">
    <my-component></my-component>
    <my-component></my-component>
    <my-component></my-component>
</div>
<script src="../../vue.min.js"></script>
<script>

    var data = {
        counter: 0
    }
    Vue.component('my-component', {
        template: `<button @click="counter++">{{counter}}</button>`,
        //mark 首字母必须小写
        // template: `<button @Click="counter++">{{counter}}</button>`,
        data: function () {
            return data;
        }
    });
    var app = new Vue({
        el: '#app',
    })
</script>
</body>
</html>